<?php
/***************************************************************************/
/* SPD Nast�tten                                                           */
/* ===========                                                             */
/*                                                                         */
/* Copyright (c) 2006-2008 by Lukas Schreiner, Pascal Villmann             */
/* For more information visit: http://spd-nastaetten.de                    */
/*                                                                         */
/*                                                                         */
/* This program is free software. You can redistribute it and/or modify    */
/* it under the terms of the GNU General Public License as published by    */
/* the Free Software Foundation; either version 0.2 of the License.        */
/***************************************************************************/
//Konfigurations-Sicherheits-Key
$config_secure_key_client = "S?a58tM!}J3gb&Z6E9{pk*Q2H1=o_Pr4Td0-7W/qCx7n2+AYf5%8?iB%zL0";
//Konfigurationsdateien einfuegen
require_once('./system/settings.inc.php');
//Markierung und Unterlinks
$home_section = "admin.php";
$home_section2 = "admin_vorstand.php";
$section = "intern.php";
//Administratorbereich nur ausgeben, wenn Session authentifiziert ist
//&Uuml;berpruefen ob "typid" existiert, wenn nicht, auf 0 setzen
if(!isset($_SESSION['typid'])) $_SESSION['typid'] = '0';
if(isset($_SESSION['auth']) && $_SESSION['typid'] > 0 && $_SESSION['timeout']>time()){
if(isset($_SESSION['rights']) && substr_count($_SESSION['rights'], ',13,') > 0 && substr_count($_SESSION['rights'], ',1,') > 0){
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php
include('./layout/head_meta.inc.php');
?>
  <style>
<!--
                .text { font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px;}
                .bild-text {color:#C0C0FF; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10px;}
-->
  </style>
</head>
<body scroll="auto" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" bgcolor="#A70D01">
  <div align="center">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td rowspan="3"><a href="admin_intern.php">
      <img name="top" src="images/spdde/portal/top/t1_1_1.gif" alt="" border="0" width="141" height="70" /></a></td>
      <td><img src="images/spdde/portal/top/t1_2_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_3.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_4_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_5.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_6_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_7.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_8_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_9.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_10_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_11.jpg" alt="" width="10" height="70" /></td>
      <td><img src="images/spdde/portal/top/t1_12_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3">
      <img border="0" src="images/spdde/portal/top/logo_neue_staerke.jpg" width="206" height="70"></td>
      <td><img src="images/spdde/portal/top/t1_14_1.jpg" alt="" width="49" height="13" /></td>
      <td rowspan="3"><img src="images/spdde/portal/top/t1_15.jpg" alt="" width="10" height="70" /></td>
    </tr>
    <tr>
      <td><a target="_blank" href="http://www.spd.de/">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_portal_aktiv.gif" width="49" height="49"></a></td>
      <td>
      <a target="_blank" href="http://www.spd.de/servlet/PB/menu/1009322/index.php">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_presse_over.gif" width="49" height="49"></a></td>
      <td>
      <a target="_blank" href="http://www.spd.de/servlet/PB/menu/1009328/index.php">
      <img border="0" src="images/spdde/portal/top/ch_quadrat_netzwerk_over.gif" width="49" height="49"></a></td>
      <td><img src="images/spdde/portal/top/t1_8_2.gif" border="0" width="49" height="49" /></td>
      <td><img src="images/spdde/portal/top/t1_10_2.jpg" alt="" width="49" height="49" /></td>
      <td><img src="images/spdde/portal/top/t1_12_2.jpg" alt="" width="49" height="49" /></td>
      <td><a target="_blank" href="http://www.spd.de/">
      <img src="images/spdde/portal/top/t1_14_2.gif" border="0" alt="" width="49" height="49" /></a></td>
    </tr>
    <tr>
      <td><img src="images/spdde/portal/top/t1_2_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_4_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_6_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_8_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_10_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_12_3.jpg" alt="" width="49" height="8" /></td>
      <td><img src="images/spdde/portal/top/t1_14_3.jpg" alt="" width="49" height="8" /></td>
    </tr>
  </table>

  <table border="0" cellspacing="0" cellpadding="0" width="750">
    <tr>
      <td><a href="template.php">
      <img src="images/spdde/portal/top/t2.jpg" alt="" border="0" width="150" height="22" /></a></td>
      <td width="600" valign="middle" align="right">
      </td>
    </tr>
  </table>

  <table border="0" cellspacing="0" cellpadding="0" width="750">
    <tr>
      <td rowspan="2" width="150" valign="top">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><td><a target="_blank" href="http://www.spd.de/">
            <img src="images/spdde/portal/top/t3.jpg" alt="" border="0" width="150" height="58" /></a></td></tr>
          <tr><td><img src="images/spdde/common/trans.gif" width="1" height="16" alt="" border="0" /></td></tr>
        </table>
<!-- Beginn der Navigation-->        
<?php
include('./layout/navigation/left_navi.inc.php');
?>
<!-- Ende der Navigation-->

      </td>
      <td rowspan="2" valign="top"><img src="images/spdde/common/trans.gif" width="10" height="1" alt="" border="0" /></td>
      <td width="410" valign="top" bgcolor="#FDF8EF"> 
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FCDAD0">
          <tr>
            <td rowspan="3"><img src="images/spdde/common/trans.gif" width="8" height="1" alt="" /></td>
            <td><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td>
            <td rowspan="3"><img src="images/spdde/common/trans.gif" width="2" height="1" alt="" /></td>
          </tr>
          <tr><td width="400" height="14" valign="middle" class="pathnolink">
            <a href="index.php">SPD-Nast&auml;tten.de</a> &gt;
            <a href="admin.php">Administration</a> &gt;
            <a href="admin_vorstand.php">Vorstand/Mitglieder</a></td></tr>
          <tr><td><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td></tr>
        </table>

<!-- Ueberschrift mit rotem Balken-->
        
        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/spdde/common/trans.gif" width="16" height="12" alt="" /></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td width="14" valign="bottom"><img src="images/spdde/portal/basics/quadrat_rechts.gif" width="10" height="6" alt="" /></td>
            <td width="364" valign="bottom"><b>Vorstand/Mitglieder</b></td>
          </tr>
          <tr>
            <td></td>
            <td><img src="images/spdde/portal/basics/quadrat_rechts.gif" width="10" height="2" alt="" /></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td colspan="2" bgcolor="#A70D01"><img src="images/spdde/common/trans.gif" width="1" height="2" alt="" /></td>
          </tr>
        </table>

<!-- Ueberschrift mit rotem Balken Ende-->

<!-- Inhaltstabelle-->


        <table border="0" cellspacing="0" cellpadding="0" height="335">
          <tr>
            <td rowspan="2" height="335"><img src="images/spdde/common/trans.gif" width="16" height="2" alt="" /></td>
            <td width="378" height="316" class="news"><p>Herzlich Willkommen <?php echo $_SESSION['vorname'] . " " . $_SESSION['name']; ?> im Administrationsbereich.<br /><br />
                        Hier k&ouml;nnen Sie den Vorstand bearbeiten, welcher auf der Seite "Vorstand" sp&auml;ter angezeigt wird.
                        Die Person mit der h&ouml;chsten Ordnungszahl steht als erster. Die niedrigste am Ende. Bitte verteilen Sie keine Doppelten Zahlen!<br />
<?php
$vorstand_SQL = "SELECT * FROM spd_vorstand WHERE vorstand_ID='".$_GET['vid']."'";
$vorstand_query = mysql_query($vorstand_SQL);
if($vorstand = mysql_fetch_array($vorstand_query)){
?>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
          <dl>
                <dt><b>Vor-, Zuname</b></dt>
                        <dd><input type="text" name="vorstand_vorname" size="15" value="<?php echo $vorstand['vorstand_vorname']; ?>" /><input type="text" name="vorstand_name" size="15" value="<?php echo $vorstand['vorstand_name']; ?>" /></dd>
                <dt><b>Stra&szlig;e</b></dt>
                        <dd><input type="text" name="vorstand_strasse" value="<?php echo $vorstand['vorstand_strasse']; ?>" /></dd>
                <dt><b>PLZ, Ort</b></dt>
                        <dd><input type="text" name="vorstand_ort" value="<?php echo $vorstand['vorstand_ort']; ?>" /></dd>
                <dt><b>E-Mail</b></dt>
                        <dd><input type="text" name="vorstand_email" value="<?php echo $vorstand['vorstand_email']; ?>" /></dd>
                <dt><b>Beruf</b></dt>
                        <dd><input type="text" name="vorstand_beruf" value="<?php echo $vorstand['vorstand_beruf']; ?>" /></dd>
                <dt><b>Bild Datei</b></dt>
                        <dd><small>(Sollten Sie das Bild noch nicht hochgeladen haben, w&auml;hlen Sie bitte ./bilder/al.gif aus!)</small><br /><?php         
function show_dir_array($myDir = "./bilder") {
    
    // diese bedingung auskommentieren, falls o.g. 
    // bedingung sichergestellt werden kann,
    // koennte bei gro�en ordnern zeit sparen.
    if(substr($myDir,-1) == "/") $myDir = substr($myDir,0,-1);
    if(!is_dir($myDir)) return array();
        
    $dir = opendir($myDir);
            
    $foo = array();
    while($file = readdir($dir)) {
        $newDir = $myDir . "/" . $file;
        if($file == "." || $file == "..")             continue;
        //if(is_dir($newDir))  $foo[] = show_dir_array($newDir . "/");
if (is_dir($newDir)) {
    array_merge($foo, show_dir_array($newDir . "/"));
} 
       $foo[] = $newDir;
    }
    return $foo;
    
}

function show_dir_string($myDir = "./bilder/", $indent = 0) {
    
    // diese bedingung auskommentieren, falls o.g. 
    // bedingung sichergestellt werden kann,
    // koennte bei gro�en ordnern zeit sparen.
    if(substr($myDir,-1) == "/") $myDir = substr($myDir,0,-1);
    if(!is_dir($myDir)) return "";
        
    $dir = opendir($myDir);
            
    $einrueckung = str_repeat("&nbsp;", $indent * 4);
    
    $foo = "";
    while($file = readdir($dir)) {
        $newDir = $myDir . "/" . $file;
        if($file == "." || $file == "..")             continue;
        
        if(is_dir($newDir))  $foo .= show_dir_string($newDir . "/", ++$indent);
        $foo .= "<option value=\"" . $newDir . "\">" . $newDir . "</option>\n";
    }
    return $foo;
    
} 

/* erste methode: alle files in einem array, schneller als show_dir_string */
 #$arr = show_dir_array();
 #print_r($arr);

//Zur Ausgabe (noch von Arcanus bsp.)
#foreach($arr as $value) 
#     $option .= '<option value="' . $value . '">'.$value.'</option>';
$option = show_dir_string(); 
  echo '<select name="vorstand_img" onchange="changes_rank_images(\'vorstand_img\',\'vorstand_img_show\');" id="vorstand_img">' . $option . '</select>';

?><br /><img src="<?php echo $vorstand['vorstand_img'] ?>" border="0" id="vorstand_img_show"></dd>
                <dt><b>Funktion</b></dt>
                        <dd><select name="vorstand_funktion">
                                        <option value="Vorsitzender" <?php if($vorstand['vorstand_funktion'] == 'Vorsitzender'){ echo "selected"; } ?>>Vorsitzender</option>
                                        <option value="2. Vorsitzender" <?php if($vorstand['vorstand_funktion'] == '2. Vorsitzender'){ echo "selected"; } ?>>2. Vorsitzender</option>
                                        <option value="Kassierer" <?php if($vorstand['vorstand_funktion'] == 'Kassierer'){ echo "selected"; } ?>>Kassierer</option>
                                    <option value="Beisitzer" <?php if($vorstand['vorstand_funktion'] == 'Beisitzer'){ echo "selected"; } ?>>Beisitzer</option>
                            </select></dd>
                        <dd><input type="checkbox" name="vorstand_schrift" value="1" <?php if($vorstand['vorstand_schrift'] == '1'){ echo "checked"; } ?> />&nbsp;Schriftf&uuml;hrer</dd>
                <dt><b>Ordnungszahl</b></dt>
                        <dd><input type="text" name="vorstand_order" size="4" value="<?php echo $vorstand['vorstand_order']; ?>" /></dd>
                <dt><b>Mitglied anzeigen auf:</b></dt>
                        <dd><input type="checkbox" name="vorstand_page1" value="1"  <?php if($vorstand['vorstand_page1'] == '1'){ echo "checked"; } ?> />&nbsp;Vorstandsseite</dd>
                        <dd><input type="checkbox" name="vorstand_page2" value="1"  <?php if($vorstand['vorstand_page2'] == '1'){ echo "checked"; } ?> />&nbsp;Bilder/Fotosseite</dd>
                <dt><img src="rechen-captcha.php"></dt>
                        <dd><input type="text" name="sicherheitscode" size="4" maxlength="2" /></dd>
        </dl>
                <input type="hidden" name="action" value="edit_vorstand" />
                <input type="hidden" name="vorstand_ID" value="<?php echo $vorstand['vorstand_ID']; ?>" />
                <input type="Submit" name="Submit" value="Speichern" />&nbsp;<input type="reset" name="Reset" value="Zur&uuml;cksetzen" />
        </form>
<?php
}else{
        echo "<br /><br /><b>Das angegebene Mitglied existiert nicht!</b>";
}
?>

          </tr>
          <tr>
            <td width="378" height="19"> 
              &nbsp;</td>
          </tr>
        </table>
        
        
<!-- Inhaltstabelle Ende-->



      </td>
      <td rowspan="2"><img src="images/spdde/common/trans.gif" width="10" height="1" alt="" border="0" /></td>
      <td rowspan="2" width="170" valign="top" bgcolor="#FDF8EF">
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FCDAD0">
          <tr><td><img src="images/spdde/common/trans.gif" width="170" height="18" alt="" /></td></tr>
        </table>

        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/spdde/common/trans.gif" width="12" height="25" alt="" /></td>
            <td></td>
          </tr>
          <tr>
            <td></td>
            <td><img src="images/spdde/portal/basics/linie_2nd.gif" width="146" height="1" vspace="2" alt="" /></td>
          </tr>
          <tr>
            <td></td>
            <td width="146"><span class="navi4thnolink">Interaktiv</span></td>
          </tr>
        </table>


<!-- Eintrag Interaktiv Anfang -->        
        <?php
include('./layout/navigation/right_navi.inc.php');
?>
<!-- Eintrag Interaktiv Ende -->
<?php
include('./layout/right.inc.php');
?>
      </td>
    </tr>
    <tr>  <!-- hier beginnt der footer -->
      <td width="410" valign="bottom" bgcolor="#FDF8EF">
        <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FDF8EF">
          <tr>
            <td rowspan="4"><img src="images/spdde/common/trans.gif" width="16" height="1" alt="" /></td>
            <td><img src="images/spdde/common/trans.gif" width="1" height="10" alt="" /></td>
          </tr>
          <tr>
            <td valign="top"><a href="#top">
            <img src="images/spdde/portal/basics/hoch.gif" border="0" alt="" width="8" height="8" /></a></td>
          </tr>
          <tr>
            <td bgcolor="#A70D01"><img src="images/spdde/common/trans.gif" width="378" height="2" alt="" /></td>
          </tr>
          <tr>
            <td height="16" valign="middle" align="right">&copy; <?php echo $global_copy . " - " . $global_years; ?> &nbsp;<a href="impressum.php">Impressum</a></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>

  </div>
</body>
</html>
<?php
//Hier Ende des authentifizierten Bereiches
}else{
header('Location: admin_false.php');
exit;
}
}else{
header('Location: false.php');
exit;
}
?>